Skip to content

Conversation

@htibosch
Copy link
Contributor

@htibosch htibosch commented Aug 6, 2025

Zynq: wait for transmission-ready before sending a new packet

In his post Long delay between two splitted frames, Tam wrote that he sees many retransmissions when sending from a Zynq7000 to a local device.

I found that in the driver, after a packet is sent, a variable int txBusy is set and when sending a new packet, the variable is cleared again. The variable should be use to synchronise the two events: TX-start and TX-end.

Now when the system is fast, the GMAC gets overrun and setting the start-bit STARTTX in the register NWCTRL is ignored. As soon as any new packet is sent, the earlier one is flushed as well. This cause many annoying re-transmissions and timeouts on the remote side.

Solution:

SemaphoreHandle_t txMutex;

This mutex will be given to by the emacps_send_handler(). It is called from an ISR so it does;

    /* Take the mutex without blocking. */
    xSemaphoreGiveFromISR( xemacpsif->txMutex, &xHigherPriorityTaskWoken );

Tam, thank you for your valuable input, and your help while we were testing.

mentioned post in the FreeRTOS forum explains it all.

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

There is no issue ID, the case was presented on the FreeRTOS forum.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@htibosch htibosch requested a review from a team as a code owner August 6, 2025 09:20
@moninom1 moninom1 changed the title Ht zynq synchronse transmission Zynq synchronize transmission Aug 7, 2025
@htibosch
Copy link
Contributor Author

htibosch commented Aug 8, 2025

This patch has been tested by Tam, see here.
The test module now runs fine, but he did find a problem in another example. I'm looking at it now.

@htibosch
Copy link
Contributor Author

htibosch commented Aug 8, 2025

@moninom1, thanks for approving, but we're not ready yet.
The patch works in one situation, not in another case.
I will report back here when the issue is solved,

@moninom1 moninom1 self-requested a review August 11, 2025 11:03
@moninom1 moninom1 marked this pull request as draft August 11, 2025 11:04
@htibosch
Copy link
Contributor Author

I continued testing the setup as described here.
My conclusion is that the Zynq network interface needs more protection against racing conditions. And also I suspect that the Python script was showing some weird characteristics.
In order to avoid confusions, I will create a new PR to solve this subject.

@htibosch htibosch mentioned this pull request Sep 1, 2025
2 tasks
@htibosch
Copy link
Contributor Author

htibosch commented Sep 1, 2025

I created a new PR 1286, which replaces this PR. It has the title "Zynq driver: avoid race conditions".

@htibosch
Copy link
Contributor Author

htibosch commented Sep 1, 2025

Please refer to PR 1286 which will replace this PR.

@htibosch htibosch closed this Sep 1, 2025
@htibosch htibosch deleted the HT_zynq_synchronse_transmission branch September 17, 2025 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants